package com.karst.webnotes.chapter03
{
	import flash.events.Event;
	
	import org.papervision3d.objects.primitives.Sphere;
	import org.papervision3d.view.BasicView;
	
	internal class NestingSample extends BasicView
	{
		public function NestingSample()
		{
			super() ;
			createView() ;
			startRendering() ;
		}

		private var parentSphere : Sphere = null ;
		private var childSphere : Sphere = null ;
		private function createView() : void
		{
			if( parentSphere == null )
				parentSphere = new Sphere( null, 300, 16, 12 ) ;
			if( childSphere == null )
				childSphere = new Sphere( null, 300, 16, 12 ) ;
			childSphere.x = 400 ;
			parentSphere.addChild( childSphere ) ;
			scene.addChild( parentSphere ) ;
		}
		
		override protected function onRenderTick(event : Event = null ) : void
		{
			super.onRenderTick() ;
			if( parentSphere )
				parentSphere.localRotationY++ ;
		}
	}
}